<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="initial-scale=1, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0" />
    <title>缩放加自由滑动</title>
    <style>
        html,
        body {
            margin: 0;
            padding: 0;
            height: 100%;
            background: #dadada;
        }
        
        header {
            height: 44px;
            line-height: 44px;
            text-align: center;
            background: #da020c;
            color: #fff;
        }
        
        h1 {
            margin: 0;
            padding: 0;
            font-size: 18px;
            font-weight: normal;
        }
        
        a {
            height: 34px;
            line-height: 34px;
            position: absolute;
            top: 5px;
            left: 10px;
        }
        
        #wrapper {
            position: absolute;
            top: 44px;
            bottom: 0;
            width: 100%;
        }
        
        #scroller {
            margin: 0;
            padding: 0;
            background: #fff;
        }

        img {
            display: block;
        }
    </style>
</head>

<body>
    <header>
        <h1>缩放加自由滑动</h1>
        <a onclick="javascript:history.back()">&lt;返回</a>
    </header>
    <div id="wrapper">
        <div id="scroller">
            <img src="http://www.chjtx.com/JRoll1/images/scrollfree.jpg" width="100%" height="auto">
        </div>
    </div>

    <script src="../vendor/fastclick.js"></script>
    <script src="../src/jroll.js"></script>
    <script>
        var jroll = new JRoll("#wrapper", {
            id: "demo4",
            zoom: true,
            scrollFree: true
        });

        var img = document.querySelector("#scroller img");

        if (img) {
            //图片加载完成后会改变scroller的高度，因此要refresh一下
            img.onload = function() {
                jroll.refresh();
            }
        }

        FastClick.attach(document.body);
    </script>
</body>

</html>